import { createRouter, createWebHistory } from 'vue-router';
import Category from '../views/catalog/Category.vue';
import Product from '../views/catalog/Product.vue';
import Item from '../views/catalog/Item.vue';
import Languages from '../components/Languages.vue';
import FoodFavorites from '../components/FoodFavorites.vue';
import SearchProduct from '../views/catalog/SearchProducts.vue';
import Cart from '../views/cart/Cart.vue';
import Checkout from '../views/cart/Checkout.vue';
import Coupon from '../views/account/Coupon.vue';
import ListOrder from '../views/order/ListOrder.vue';
import OrderTabs from '../views/order/OrderTabs.vue'; 
import OrderView from '../views/order/OrderView.vue';
import OrderSuccess from '../views/common/OrderSuccess.vue';
import Main from '../views/Main.vue';
import Home from '../views/Home.vue';
import SignOn from '../views/account/SignOn.vue';
import Register from '../views/account/Register.vue';
import Help from '../views/common/Help.vue';
import MyAccount from '../views/account/MyAccount.vue';
import component from 'element-plus/es/components/tree-select/src/tree-select-option.mjs';

const routes = [
  { path: '/', component: Home, name: 'Home' },
  { path:'/main', component: Main, name:'Main'},
  { path: '/catalog/:categoryId', component: Category , name: 'Category'},
  { path: '/product/:categoryId/:productId', component: Product , name: 'Product' },
  { path: '/item/:itemId', component: Item, name: 'Item' },
  { path: '/languages', component: Languages, name: 'Languages' },
  { path: '/favorites', component: FoodFavorites, name: 'FoodFavorites' },
  { path: '/search', component: SearchProduct, name: 'SearchProduct'},
  { path: '/cart', component: Cart, name: 'Cart' },
  { path : '/checkout', component: Checkout, name: 'Checkout' },
  { path : '/coupon', component: Coupon, name: 'Coupon' },
  { path : '/listorder',component:ListOrder,name:'ListOrder'},
  { path :'/orderview', component:OrderView},
  { path : '/orders/:orderId', component: OrderView }, // 支持 /orders/:id
  { path : '/ordersuccess', component: OrderSuccess, name: 'OrderSuccess' },
  { path:'/ordertabs',component:OrderTabs, name:'OrderTabs'},
  { path:'/signon',component:SignOn,name:'SignOn'},
  { path:'/register', component: Register, name:'Register'},
  { path:'/help', component: Help, name:'Help'},
  {path:'/myaccount',component:MyAccount,name:'MyAccount'}
]
const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;